#ifndef SO_PMI
#define SO_PMI
#include "define.h"
bool readDict(CString &FileName,int classId,sentiDict &Dict);
bool writeDict(rateWordMap &words,CString &filename,double max,double min,bool reverse=false);
std::vector<int> getCount(const CString& filename); 
class CSO_PMI
{
public:
	CSO_PMI(int dim,int bcnt,int pmiDist,const CString& workDir);
	bool init();
	bool fisher();
	bool filter(const CString& dictDir);
	bool weighting(const CString &targetDir);	
	double GetAlpha();
private:
	bool traverse(const CString &targetDir);
	bool loadClassCount(std::vector<int> classCount);
	bool readCount(const CString &Filename);  
    bool initBaseArray();
	//void normalize(rateWordMap& wordList,double max,double min);
	double getAlpha();
	void countRecord();
    bool calculate();
private:
	CString				 m_workDir;
    std::vector<CString> m_posBase;
    std::vector<CString> m_negBase;
	std::vector<int>     m_classCount;
	PMIMap m_pmiMap;
	wordCountMap m_countList;
	rateWordMap  m_rateList;
    rateWordMap m_FisherList;
    rateWordMap m_negList;
    rateWordMap m_posList;	
	sentiDict m_totalDict;
	sentiDict m_baseDict;
	int m_dim;
	int m_bcnt;
	int m_pmiDist;
	double m_alpha;
};

#endif